using System;
using System.Collections.Generic;
using System.Text;

namespace Madason.MetaModel.DAO
{
	public class IBatisStrategy : IDatabaseStrategy
	{
		#region IDatabaseStrategy Member

		public bool ShouldUseSequenceForInsert(Entity entity)
		{
			return true;
		}

		public bool ShouldUseIdentityFieldForInsert(Entity entity)
		{
			return false;
		}

		public bool ShouldInsertPrimaryKey(Entity entity)
		{
			return true;
		}

		public string WrapAttribute(string name)
		{
			return name;
		}

		public string InsertParameter(string name)
		{
			return "#" + name + "#";
		}

        //added by hefeisla
        public string ColumnType(string fullname)
        {
            return fullname;
        }

        //added by hefeisla
        public string WrapTableName(string name)
        {
            return name;
        }

        //added by hefeisla
        public string GetReaderGetter(string type)
        {
            if (type == "string") return "GetString";
            if (type == "int") return "GetInt32";
            if (type == "bool") return "GetBoolean";
            if (type == "float") return "GetDouble";
            if (type == "double") return "GetDouble";
            if (type == "System.DateTime") return "GetDateTime";
            if (type == "DateTime") return "GetDateTime";
            if (type == "Enum") return "GetInt32";
            return "?" + type + "?";
        }
        
        public string GetClassSuffix()
		{
			throw new Exception("Not supported");
		}

		#endregion
	}
}
